package com.googlecode.horncomb.orm.dao;

import java.io.Serializable;
import java.util.Set;

/**
 * entity dao
 * @author Daniel
 */
public interface EntityBaseDao<T extends Serializable> extends Serializable {

	T createNewEntity();

	/**
	 * save entity. auto-call the insert or update.
	 * @param entity
	 */
	void save(T entity);

	/**
	 * insert a new entity
	 * @param entity
	 */
	void insert(T entity);

	/**
	 * update a entity
	 * @param entity
	 */
	void update(T entity);

	/**
	 * get entity by id
	 * @param id
	 * @return single entity
	 */
	T getById(Serializable id);

	/**
	 * delete a entity by id
	 * @param id
	 *            id
	 */
	void deleteById(Serializable id);

	/**
	 * delete entity by ids
	 * @param id
	 */
	void deleteByIds(Set<? extends Serializable> id);
}
